package info.techgeek.labs.classloader;

public class ClassLoaderTest {

	public static void main(String[] args) {
		
		ClassLoaderTest classLoaderTest = new ClassLoaderTest();
		System.out.println(classLoaderTest.getClassLocation());
		
	}
	
	public String getClassLocation() {
		
		  String className = this.getClass().getName();
		  System.out.println(className);
		  className = className.replace('.', '/');
		  System.out.println(className);
		  className = '/' + className + ".class";
		  System.out.println(className);
		  java.net.URL classUrl = this.getClass().getResource(className);
		  System.out.println(classUrl);
		  String arr[] = classUrl.getFile().split("!");
		  System.out.println(arr[0].replaceFirst("file:/", ""));
		  return arr[0].replaceFirst("file:/", "");
		 }
	
	
}
